package com.anlu.concurrent.ch1.wn;

import sun.awt.windows.ThemeReader;

/**
 * <p>
 * Description:TODO 详细描述
 * <p>
 * Copyright: 天津联想协同科技有限公司
 * <p>
 *
 * @author anlu
 * @date 2021/9/3 17:32
 */
public class TestWN {
    private static Express express = new Express(0,Express.CITY);

    /**
     * 检查里程数变化的线程,不满足条件，线程一直等待
     */
    private static class CheckKm extends Thread{
        @Override
        public void run() {
            express.waitKm();
        }
    }

    /**
     * 检查地点变化的线程，不满足条件，线程一直等待
     */
    private static class  CheckSite extends Thread{
        @Override
        public void run() {
            express.waitSite();
        }
    }

    public static void main(String[] args)throws InterruptedException {
        //三个线程
        for(int i=0;i<3;i++){
            new CheckSite().start();
        }
        //里程数的变化
        for(int i=0;i<3;i++){
            new CheckKm().start();
        }
        Thread.sleep(1000);
        express.changeKm();//快递地点变化
//        Thread.sleep(1000);
//        express.changeSite();
    }
}
